package com.bittech.facerecognition.web;

import com.bittech.facerecognition.client.FaceAiClient;
import com.bittech.facerecognition.model.Response;

import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * Author: secondriver
 * Created: 2019/5/28
 */
public class AbstractBaseServlet extends HttpServlet {
    
    protected FaceAiClient faceAiClient = new FaceAiClient();
    
    protected void responseJSON(HttpServletResponse response, Response data) {
        response.setCharacterEncoding("UTF-8");
        response.setContentType("application/javascript");
        try {
            response.getWriter().write(data.toString());
            response.getWriter().flush();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
